package com.ruoyi.wbgame.service.impl;

import java.util.List;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.wbgame.mapper.WbOptionMapper;
import com.ruoyi.wbgame.domain.WbOption;
import com.ruoyi.wbgame.service.IWbOptionService;
import com.ruoyi.common.core.text.Convert;

/**
 * 选项Service业务层处理
 * 
 * @author guguofu
 * @date 2021-04-19
 */
@Service
public class WbOptionServiceImpl implements IWbOptionService 
{
    @Autowired
    private WbOptionMapper wbOptionMapper;

    /**
     * 查询选项
     * 
     * @param optionId 选项ID
     * @return 选项
     */
    @Override
    public WbOption selectWbOptionById(Long optionId)
    {
        return wbOptionMapper.selectWbOptionById(optionId);
    }

    /**
     * 查询选项列表
     * 
     * @param wbOption 选项
     * @return 选项
     */
    @Override
    public List<WbOption> selectWbOptionList(WbOption wbOption)
    {
        return wbOptionMapper.selectWbOptionList(wbOption);
    }

    /**
     * 新增选项
     * 
     * @param wbOption 选项
     * @return 结果
     */
    @Override
    public int insertWbOption(WbOption wbOption)
    {
        return wbOptionMapper.insertWbOption(wbOption);
    }

    /**
     * 修改选项
     * 
     * @param wbOption 选项
     * @return 结果
     */
    @Override
    public int updateWbOption(WbOption wbOption)
    {
        return wbOptionMapper.updateWbOption(wbOption);
    }

    /**
     * 删除选项对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteWbOptionByIds(String ids)
    {
        return wbOptionMapper.deleteWbOptionByIds(Convert.toStrArray(ids));
    }

    /**
     * 删除选项信息
     * 
     * @param optionId 选项ID
     * @return 结果
     */
    @Override
    public int deleteWbOptionById(Long optionId)
    {
        return wbOptionMapper.deleteWbOptionById(optionId);
    }

    /**
     * 通过问题 id 删除选项
     * @param questionId    关联的问题id
     * @return 删除的选项个数
     */
    @Override
    public int deleteWbOptionByQuestionId(Long questionId) {
        return wbOptionMapper.deleteWbOptionByQuestionId(questionId);
    }
}
